<?php
if (!defined("IN_OP")) {
    exit("You can't access this file directly...");
}
include_once( "class/function_3d.php" );
$gametype = intval(getvar("gametype"));
$chkGametype = chkGametype($gametype);
if ($gametype == 0) {
    $ui = new UI();
} else {
    include_once( "class_3d/CheckMode_3d.php" );
    $chk = new CheckMode_3d($curruser['acl'], 1, $gametype);
    $chk->checkShow3dPage();
    unset($chk);
    $ui = new UI_3D();
    $ui->header();
}
$tpl = new Template2();
$methodArr = array("单号+-", "快选调整", "快选升降", "快速变更", "整组号码+-", "直接更新", "双面盘操盘连动", "八球同步操盘", "自动累进降倍");
$pagenameArr = array("操盘", "开奖", "基本", "自动");
$tblName = $g_gametype_3d[$gametype]['ch'];
$page = getvar("page");
$page = $page == "" ? 1 : intval($page);
$srcText = getvar("srcText");
$pagename = getvar("pagename");
$pagename = $pagename == "" ? "" : intval($pagename);
$pagesize = 20;
$paperopen = getvar("paperopen");
$tbdList = "";
$sqlAdd = "";
if (is_date($paperopen, 0)) {
    $sqlAdd .= " AND paperopen = '{$paperopen}' ";
} else {
    $paperopen = " 不限 ";
}
if ($pagename != "") {
    $sqlAdd .= " AND pagename = '{$pagename}' ";
    $pagenameStr = $pagenameArr[$pagename];
} else {
    $pagenameStr = "不限";
}
if ($srcText != "") {
    if ($g_conf['language'] == "zh-cn") {
        include_once( "class/ccharset.php" );
        $cc = new CCharset();
        $srcText = $cc->Gb_Big5(safeHTML($srcText));
    }
    $sqlAdd .= " AND betcontent LIKE '%{$srcText}%' ";
}
if ($curruser['account'] != G_SUPERACCOUNT) {
    $sqlAdd .= " AND user_account != '" . G_SUPERACCOUNT . "' ";
}
$sqlAddTemp = $curruser['acl'] == 255 ? " AND acl = 255 " : " AND user_id = " . $curruser['id'];
$sqlAdd .= $sqlAddTemp;
$sql = "SELECT * FROM rate_record WHERE gametype = {$gametype} {$sqlAdd} ORDER BY uptime DESC, id DESC";
$rs = getdb($sql, $page, $pagesize);
if (!$rs->eof) {
    $tbdList = "";
    while (!$rs->eof) {
        $tbdList .= "<tr class=\"td2\" align=\"center\">";
        $tbdList .= "<td>" . ( $rs->f['acl'] == 300 ? "连控操盘员" : $rs->f['user_account'] ) . "</td>";
        $tbdList .= "<td nowrap>" . $rs->f['uptime'] . "</td>";
        $tbdList .= "<td>" . $pagenameArr[$rs->f['pagename']] . "</td>";
        if (1000 < $rs->f['method']) {
            $m1 = intval(substr($rs->f['method'], 1, 0 - 2));
            $m2 = intval(substr($rs->f['method'], 0 - 2));
            $tbdList .= "<td>{$methodArr[$m1]} [{$methodArr[$m2]}]</td>";
        } else {
            $tbdList .= "<td>" . $methodArr[$rs->f['method']] . "</td>";
        }
        $tbdList .= "<td>" . $g_gametype_3d[$rs->f['gametype']]['ch'] . "</td>";
        $tbdList .= "<td>" . $rs->f['round'] . "</td>";
        $tbdList .= "<td align='left'>" . $rs->f['betcontent'] . "</td>";
        $tbdList .= "<td>" . floatval($rs->f['orate']) . "</td>";
        $tbdList .= "<td>" . floatval($rs->f['nrate']) . "</td>";
        $tbdList .= "<td align=\"right\">" . $rs->f['ip'] . "</td>";
        $tbdList .= "</tr>";
        $rs->next();
    }
} else {
    $tbdList = "<tr><td colspan=\"10\" align=\"center\" class=\"td2\">查无资料</td></tr>";
}
$tpl->load("main", "rateRecord.htm");
$tpl->set(array("tbdList" => $tbdList, "pageLink" => $rs->pagelink(), "gametype" => $gametype));
$frmSrc = "<form action=\"op.php?op=subsidary&fp=rateRecord_3d&paperopen={$paperopen}&gametype={$gametype}\" method=\"post\" style=\"margin:0\">";
$frmSrc .= "种类 : <input type=\"text\" value=\"{$srcText}\" name=\"srcText\" /><input type=\"submit\" value=\"查询\" /></form>";
echo title(" [ {$tblName} ] 赔率异动记绿 || 报表日期 : {$paperopen} || 页面 : {$pagenameStr}", $frmSrc);
$tpl->show("main");
echo "</body></html>";
?>